<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>13fullpage</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            list-style: none;
        }

        body {
            overflow-x: hidden;
        }

        .box {
            height: 100vh;
            position: relative;
            overflow: hidden;
        }

        .wrap {
            position: absolute;
            top: 0;
        }

        .page {
            width: 100vw;
            height: 100vh;
            color: white;
            text-align: center;
            line-height: 100vh;
            font-size: 200px;
        }
    </style>
    <script src="../jquery-1.11.3/jquery.min.js"></script>
</head>

<body>
    <div class="box">
        <div class="wrap">
            <div class="page" style="background: red;">1</div>
            <div class="page" style="background: yellow;">2</div>
            <div class="page" style="background: blue;">3</div>
            <div class="page" style="background: green;">4</div>
            <div class="page" style="background: orange;">5</div>
        </div>
    </div>
</body>
<script>
    var oWrap = document.getElementsByClassName("wrap")[0];
    var aPages = document.getElementsByClassName("page");
    // console.log(window.innerWidth,window.innerHeight)
    window.onresize=window.onload = function () {
        for (var i = 0; i < aPages.length; i++) {
            aPages[i].style.height = window.innerHeight + "px";
            aPages[i].style.width = window.innerWidth + "px";
        }
    }

    // 初始化一个值
    var index = 0;
    // 火狐浏览器
    window.addEventListener("DOMMouseScroll", function (e) {
        scroll1(e)
    })
    // 非火狐浏览器
    window.onmousewheel = function (e) {
        e = e || window.event;
        scroll1(e);
    }
    // 滚动动画
    function animate1(index) {
        oWrap.style.top = -(window.innerHeight) * index + "px";
        oWrap.style.transition = "all 1s ease";
    }
    // 判断
    function scroll1(e) {
        if (oWrap.offsetTop == -(window.innerHeight) * index) {
            if (e.detail > 0 || e.wheelDelta < 0) {
                // 向下滚动
                index > 3 ? index = 4 : index++;
                animate1(index);
            }
            if (e.detail < 0 || e.wheelDelta > 0) {
                // 向上滚动
                index < 1 ? index = 0 : index--;
                animate1(index);
            }
        } else {

        }
    }
</script>

</html>